/**
 @file sys_usw_nexthop_api.h

 @date 2011-11-07

 @version v2.0

*/
#ifndef _SYS_USW_NEXTHOP_API_H_
#define _SYS_USW_NEXTHOP_API_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "sal.h"
#include "ctc_linklist.h"
#include "ctc_hash.h"
#include "ctc_vector.h"
#include "ctc_vlan.h"
#include "ctc_nexthop.h"
#include "ctc_stats.h"
#include "ctc_nexthop_fp.h"


#define SYS_NHID_EXTERNAL_MAX                  8192
#define SYS_NHID_INTERNAL_START  (SYS_NHID_EXTERNAL_MAX)


#define SYS_NH_MET_DROP_UCAST_ID          SYS_RSV_PORT_DROP_ID
#define SYS_NH_IGS_CHIP_EDIT_MODE  0
#define SYS_NH_EGS_CHIP_EDIT_MODE  1
#define SYS_NH_EDIT_MODE_IGS       0      /*ingress mode*/
#define SYS_NH_EDIT_MODE_USER_DEF  1      /*user define mode*/
#define SYS_NH_EDIT_MODE_MISC      2      /*misc mode*/

#define SYS_NH_INTERNAL_NHID_BASE 0x80000000

#define SYS_NH_ECMP_RR_COUNT 16

/* D2/TM
   1. DsFwd.nexthopPtr[17]: global disable logic port type/logicPortType
   2. DsFwd.nexthopPtr[16]: Used to store loopback localPhyPort[7];
   3. DsFwd.nexthopPtr[15]: custom exp map valid
   4. DsFwd.nexthopPtr[14:12]: packet type
   5. DsFwd.nexthopPtr[11]: packet type valid
   6. DsFwd.nexthopPtr[10]: vpls port type/logicPortType
   7. DsFwd.nexthopPtr[9:8]: bytes_to_remove; cm_packet_header.next_hop_ext
   8. DsFwd.nexthopPtr[7]:  use outer ttl(useOuterTtl)
   9. DsFwd.nexthopPtr[6:0]: Used to store loopback localPhyPort[6:0];

   TMM
   1. DsFwd.nexthopPtr[17]: global disable logic port type/logicPortType
   2. DsFwd.nexthopPtr[16]: bytes_to_remove/fwdHashGenDis
   3. DsFwd.nexthopPtr[15]: custom exp map valid
   4. DsFwd.nexthopPtr[14:12]: packet type
   5. DsFwd.nexthopPtr[11]: packet type valid
   6. DsFwd.nexthopPtr[10]: vpls port type/logicPortType
   7. DsFwd.nexthopPtr[9]: select localPhyPort from PacketHeader.localPhyPort
   8. DsFwd.nexthopPtr[8]: bytes_to_remove/useOuterTtl
   9. DsFwd.nexthopPtr[7:0]: Used to store loopback localPhyPort[7:0];

   AT
   1. DsFwd.nexthopPtr[17]: global disable logic port type/logicPortType
   2. DsFwd.nexthopPtr[16]: bytes_to_remove/fwdHashGenDis
   3. DsFwd.nexthopPtr[15]: useOuterTtl
   4. DsFwd.nexthopPtr[14]: Used to store loopback localPhyPort[8]
   5. DsFwd.nexthopPtr[13:12]: packet type to mapping
   6. DsFwd.nexthopPtr[11]: packet type valid
   7. DsFwd.nexthopPtr[10]: vpls port type/logicPortType
   8. DsFwd.nexthopPtr[9]: select localPhyPort from PacketHeader.localPhyPort
   9. DsFwd.nexthopPtr[8]: bytes_to_remove
   10. DsFwd.nexthopPtr[7:0]: Used to store loopback localPhyPort[7:0]
*/
#define SYS_NH_ENCODE_ILOOP_DSNH(lport, logic_port, cid_valid, remove_words, clear_logic_port) \
(DRV_FROM_AT(lchip)? (((lport&0xFF) | ((lport >> 8) << 14)) | (((remove_words & 0x3) >> 1) << 8) | ((remove_words & 0x1) << 16) | (logic_port << 10) | (clear_logic_port << 17) ) : \
    (((DRV_IS_TMM(lchip) || DRV_IS_TMG(lchip)))?((lport&0xFF) | (((remove_words & 0x3)>>1) << 16) | ((remove_words & 0x1) << 8)| (logic_port << 10) | (clear_logic_port <<17) ):\
    ((lport & 0x7F) | (((lport>>7)&0x1)<<16)| ((remove_words & 0x3) << 8) | (logic_port << 10) | (clear_logic_port <<17) )))

#define SYS_NH_TYPE_STEP_TO_INNER (DRV_FROM_AT(lchip)?(SYS_NH_ENTRY_TYPE_L2EDIT_INNER_FROM - SYS_NH_ENTRY_TYPE_L2EDIT_FROM):0) /*map to inner edit for AT*/
#define SYS_NH_OVERLAY_NEW_MODE(lchip) ((sys_usw_nh_get_vxlan_mode(lchip) == 2))

typedef int32 (* nh_traversal_fn)(uint8 lchip, void* nh_info, void* user_data);

enum sys_nh_info_flag_type_e
{
    SYS_NH_INFO_FLAG_IS_UNROV = 0x0001,
    SYS_NH_INFO_FLAG_USE_DSNH8W = 0x0002,
    SYS_NH_INFO_FLAG_IS_APS_EN = 0x0004,
    SYS_NH_INFO_FLAG_HAVE_DSFWD = 0x0008,
    SYS_NH_INFO_FLAG_USE_ECMP_IF = 0x0010,
    SYS_NH_INFO_FLAG_HAVE_L2EDIT = 0x0020,
    SYS_NH_INFO_FLAG_HAVE_L3EDIT = 0x0040,
    SYS_NH_INFO_FLAG_HAVE_INT_ALLOC_DSNH = 0x0080,
    SYS_NH_INFO_FLAG_MPLS_POP_NH = 0x0100,
    SYS_NH_INFO_FLAG_IS_APS_SHARE_DSNH = 0x0200,
    SYS_NH_INFO_FLAG_HAVE_RSV_DSNH = 0x0400,
    SYS_NH_INFO_FLAG_EGRESS_EDIT_MODE = 0x0800,
    SYS_NH_INFO_FLAG_LOGIC_PORT = 0x1000,
    SYS_NH_INFO_FLAG_HORIZON_SPLIT_EN = 0x2000,
    SYS_NH_INFO_FLAG_HAVE_SWAP_L2EDIT = 0x4000,
    SYS_NH_INFO_FLAG_LEN_ADJUST_EN = 0x8000,
    SYS_NH_INFO_FLAG_HAVE_L2EDI_3W = 0x10000,
    SYS_NH_INFO_FLAG_HAVE_L2EDI_6W = 0x20000,
    SYS_NH_INFO_FLAG_HAVE_RSV_DSFWD = 0x40000,
    SYS_NH_INFO_FLAG_ROUTE_OVERLAY = 0x80000,
    SYS_NH_INFO_FLAG_LOGIC_PORT_CHECK = 0x100000,
    SYS_NH_INFO_FLAG_LOGIC_REPLI_EN = 0x200000,
    SYS_NH_INFO_FLAG_MCAST_PROFILE = 0x400000,
    SYS_NH_INFO_FLAG_DSFWD_IS_6W = 0x800000,
    SYS_NH_INFO_FLAG_LOOP_USED = 0x1000000,
    SYS_NH_INFO_FLAG_HAVE_DSFWD1 = 0x2000000,  /*AT*/
    SYS_NH_INFO_FLAG_LB_WITH_LOGIC_DST = 0x4000000,
    SYS_NH_INFO_FLAG_DIRTY = 0x8000000,
    SYS_NH_INFO_FLAG_NO_HW = 0x10000000,
    SYS_NH_INFO_FLAG_TS_EDIT = 0x10000000
};
typedef enum sys_nh_info_flag_type_e sys_nh_info_flag_type_t;

enum sys_nh_info_mcast_flag_e
{
    SYS_NH_INFO_MCAST_FLAG_IS_MIRROR          =  0x0001,
    SYS_NH_INFO_MCAST_FLAG_STK_MEM_PROFILE    =  0x0002,   /*means mcast member have used mcast profile, only support one member is profile*/
    SYS_NH_INFO_MCAST_FLAG_MEM_PROFILE        =  0x0004,   /*means mcast member have used mcast profile, only support one member is profile*/
    SYS_NH_INFO_MCAST_FLAG_LOGIC_REP_EN       =  0x0008,   /*means mcast group enable logic replicate, for ipmc */
    SYS_NH_INFO_MCAST_FLAG_BASC_OFFSET_USED   =  0x0010,   /*means basic offset have been uased */
    SYS_NH_INFO_MCAST_FLAG_LOGIC_REP_LIST_EN  =  0x0020,   /*means logic replicate list, for tmm */
    SYS_NH_INFO_MCAST_FLAG_LOGIC_REP_ABILITY  =  0x0040,   /*means logic replicate ability, Notice: just means have the avility for tmm */
    SYS_NH_INFO_MCAST_FLAG_2X_GRP_ID          =  0x0080,   /*means the group occupy two continuous group id */
    SYS_NH_INFO_MCAST_FLAG_4X_GRP_ID          =  0x0100,   /*means the group occupy four continuous group id */
    SYS_NH_INFO_MCAST_FLAG_SRC_CHK_DISABLE    =  0x0200,   /*means disable source port check for all member in the group, for TM */

    SYS_NH_INFO_MCAST_FLAG_MAX
};
typedef enum sys_nh_info_mcast_flag_e sys_nh_info_mcast_flag_t;

enum sys_nh_entry_table_type_e
{
    SYS_NH_ENTRY_TYPE_NULL,                                             /*0*/

    SYS_NH_ENTRY_TYPE_FWD = SYS_NH_ENTRY_TYPE_NULL,                     /*0*/
    SYS_NH_ENTRY_TYPE_FWD_HALF,                                         /*1*/
    SYS_NH_ENTRY_TYPE_FWD1 ,                                            /*2*/
    SYS_NH_ENTRY_TYPE_FWD_HALF1,                                        /*3*/
    SYS_NH_ENTRY_TYPE_MET,                                              /*4*/
    SYS_NH_ENTRY_TYPE_MET_RSVED,                                        /*5*/
    SYS_NH_ENTRY_TYPE_MET_6W,                                           /*6*/
    SYS_NH_ENTRY_TYPE_MET_12W,                                          /*7, AT*/
    SYS_NH_ENTRY_TYPE_NEXTHOP_INTERNAL,                                 /*8*/
    SYS_NH_ENTRY_TYPE_NEXTHOP_4W,                                       /*9*/
    SYS_NH_ENTRY_TYPE_NEXTHOP_8W,                                       /*10*/

    /* +++1. individual edit memory +++ */
    SYS_NH_ENTRY_TYPE_L2EDIT_OUTER_4W,                                  /*12*/
    SYS_NH_ENTRY_TYPE_L2EDIT_OUTER_8W,                                  /*13*/
    SYS_NH_ENTRY_TYPE_L3EDIT_SPME,                                      /*23*/

    /* +++2. share edit memory +++ */
    /* +++2.1  l2edit share memory +++ */
    SYS_NH_ENTRY_TYPE_L2EDIT_FROM,                                      /*8*/
    SYS_NH_ENTRY_TYPE_L2EDIT_INNER_3W = SYS_NH_ENTRY_TYPE_L2EDIT_FROM,  /*8*/
    SYS_NH_ENTRY_TYPE_L2EDIT_INNER_6W,                                  /*9*/
    SYS_NH_ENTRY_TYPE_L2EDIT_INNER_3W_RW,                               /*10, FROM TMM*/
    SYS_NH_ENTRY_TYPE_L2EDIT_INNER_6W_RW,                               /*11, FROM TMM*/
    SYS_NH_ENTRY_TYPE_L2EDIT_FLEX_8W,                                   /*14*/
    SYS_NH_ENTRY_TYPE_L2EDIT_OF_6W,                                     /*15*/
    SYS_NH_ENTRY_TYPE_L2EDIT_LPBK,                                      /*16*/
    SYS_NH_ENTRY_TYPE_L2EDIT_PBB_4W,                                    /*17*/
    SYS_NH_ENTRY_TYPE_L2EDIT_PBB_8W,                                    /*18*/
    SYS_NH_ENTRY_TYPE_L2EDIT_SWAP,                                      /*19, 6w size*/
    SYS_NH_ENTRY_TYPE_L2EDIT_INNER_SWAP,                                /*20, 3w size*/
    SYS_NH_ENTRY_TYPE_L2EDIT_TO = SYS_NH_ENTRY_TYPE_L2EDIT_INNER_SWAP,  /*20*/
    /* +++2.2  l3edit share memory +++ */
    SYS_NH_ENTRY_TYPE_L3EDIT_FROM,                                      /*21*/
    SYS_NH_ENTRY_TYPE_L3EDIT_FLEX= SYS_NH_ENTRY_TYPE_L3EDIT_FROM,       /*21*/
    SYS_NH_ENTRY_TYPE_L3EDIT_MPLS,                                      /*22*/
    SYS_NH_ENTRY_TYPE_L3EDIT_MPLS_2X,                                   /*24, FROM TMM*/
    SYS_NH_ENTRY_TYPE_L3EDIT_MPLS_12W,                                  /*25*/
    SYS_NH_ENTRY_TYPE_L3EDIT_OF_6W,                                     /*26*/
    SYS_NH_ENTRY_TYPE_L3EDIT_OF_12W,                                    /*27*/
    SYS_NH_ENTRY_TYPE_L3EDIT_FP,                                        /*28*/
    SYS_NH_ENTRY_TYPE_L3EDIT_NAT_4W,                                    /*29*/
    SYS_NH_ENTRY_TYPE_L3EDIT_NAT_8W,                                    /*30*/
    SYS_NH_ENTRY_TYPE_L3EDIT_NAT_V6_8W,                                 /*31*/
    SYS_NH_ENTRY_TYPE_L3EDIT_NAT_V6_16W,                                /*32*/
    SYS_NH_ENTRY_TYPE_L3EDIT_ADD_SRV6,                                  /*33, FROM TMM*/
    SYS_NH_ENTRY_TYPE_L3EDIT_RW_SRV6,                                   /*34, FROM TMM*/
    SYS_NH_ENTRY_TYPE_L3EDIT_SRH,                                       /*35, FROM TMM*/
    SYS_NH_ENTRY_TYPE_L3EDIT_TRILL,                                     /*36*/
    SYS_NH_ENTRY_TYPE_L3EDIT_TUNNEL_V4,                                 /*37*/
    SYS_NH_ENTRY_TYPE_L3EDIT_TUNNEL_V4_4X,                              /*38, FROM TMM*/
    SYS_NH_ENTRY_TYPE_L3EDIT_TUNNEL_V6,                                 /*39*/
    SYS_NH_ENTRY_TYPE_L3EDIT_LPBK,                                      /*40*/
    SYS_NH_ENTRY_TYPE_L3EDIT_ADD_RAW,                                      /*41*/
    SYS_NH_ENTRY_TYPE_L3EDIT_TO = SYS_NH_ENTRY_TYPE_L3EDIT_ADD_RAW,        /*41*/
    /* +++2.3  l2edit share memory inner for AT +++ */
    SYS_NH_ENTRY_TYPE_L2EDIT_INNER_FROM,
    SYS_NH_ENTRY_TYPE_L2EDIT_INNER_TO = SYS_NH_ENTRY_TYPE_L2EDIT_INNER_FROM + SYS_NH_ENTRY_TYPE_L2EDIT_TO - SYS_NH_ENTRY_TYPE_L2EDIT_FROM,
    /* +++2.4  l3edit share memory inner for AT +++ */
    SYS_NH_ENTRY_TYPE_L3EDIT_INNER_FROM,
    SYS_NH_ENTRY_TYPE_L3EDIT_INNER_TO = SYS_NH_ENTRY_TYPE_L3EDIT_INNER_FROM + SYS_NH_ENTRY_TYPE_L3EDIT_TO - SYS_NH_ENTRY_TYPE_L3EDIT_FROM,

    /* +++3  Register +++ */
    SYS_NH_ENTRY_TYPE_L3EDIT_TUNNEL_V4_IPSA,
    SYS_NH_ENTRY_TYPE_L3EDIT_TUNNEL_V6_IPSA,

    /* +++ ecmp +++ */
    SYS_NH_ENTRY_TYPE_ECMP_GROUP,
    SYS_NH_ENTRY_TYPE_ECMP_MEMBER,
    SYS_NH_ENTRY_TYPE_ECMP_RR_COUNT,
    /* --- ecmp --- */

    SYS_NH_ENTRY_TYPE_L2EDIT_VLAN_PROFILE,
    SYS_NH_ENTRY_TYPE_DESTMAP_PROFILE,
    SYS_NH_ENTRY_TYPE_FP_ALU_PROFILE,
    SYS_NH_ENTRY_TYPE_FP_DATA_PROFILE,
    SYS_NH_ENTRY_TYPE_FP_L3CHKSUM_PROFILE,
    SYS_NH_ENTRY_TYPE_FP_L4CHKSUM_PROFILE,
    SYS_NH_ENTRY_TYPE_XFP_EDIT,
    SYS_NH_ENTRY_TYPE_XFP_ALU_PROFILE,
    SYS_NH_ENTRY_TYPE_XFP_DATA_PROFILE,
    SYS_NH_ENTRY_TYPE_LOGIC_REP,
    SYS_NH_ENTRY_TYPE_LOGIC_DEST_PORT,
    SYS_NH_ENTRY_TYPE_LDP_MAC_PROFILE,
    SYS_NH_ENTRY_TYPE_LOGIC_DEST_PORT_EXT,

    SYS_NH_ENTRY_TYPE_MAX
};
typedef enum sys_nh_entry_table_type_e sys_nh_entry_table_type_t;

enum sys_nh_param_mcast_opcode_e
{
    SYS_NH_PARAM_MCAST_ADD_MEMBER            = 1,
    SYS_NH_PARAM_MCAST_DEL_MEMBER            = 2,
    SYS_NH_PARAM_MCAST_UPDATE_MEMBER         = 3,
    SYS_NH_PARAM_MCAST_UPDATE_GRP            = 4
};
typedef enum sys_nh_param_mcast_opcode_e sys_nh_param_mcast_opcode_t;


enum sys_nh_param_mcast_member_type_s
{
    SYS_NH_PARAM_BRGMC_MEM_LOCAL = 0,
    SYS_NH_PARAM_BRGMC_MEM_LOCAL_WITH_APS_BRIDGE,
    SYS_NH_PARAM_IPMC_MEM_LOCAL,
    SYS_NH_PARAM_MCAST_MEM_LOCAL_WITH_NH,
    SYS_NH_PARAM_MCAST_MEM_LOCAL_WITH_NH_DESTID,
    SYS_NH_PARAM_MCAST_MEM_REMOTE,
    SYS_NH_PARAM_BRGMC_MEM_RAPS,
    SYS_NH_PARAM_MCAST_MEM_LOCAL_LOGIC_REP,
    SYS_NH_PARAM_IPMC_MEM_LOCAL_LOGIC_REP,
    SYS_NH_PARAM_MCAST_MEM_MIRROR_WITH_NH,
    SYS_NH_PARAM_IPMC_MEM_LOOP_BACK,
    SYS_NH_PARAM_BRGMC_MEM_BITMAP,
    SYS_NH_PARAM_MEM_LOGIC_REP_LIST,
    SYS_NH_PARAM_MCAST_MEM_INVALID
};
typedef enum sys_nh_param_mcast_member_type_s sys_nh_param_mcast_member_type_t;

struct sys_nh_info_bind_s
{
    void* data;
    int32 (* updateAd) (uint8 lchip,void* ipuc_node, void* dsnh_info);
    uint32 chk_data;                         /*used to verify bind data have change*/
    uint32 bind_feature:8;
    uint32 bind_lchip  :8;
    uint32 rsv         :16;
};
typedef struct sys_nh_info_bind_s sys_nh_info_bind_t;


struct sys_nh_ref_list_node_s
{
    struct sys_nh_info_com_s* p_ref_nhinfo;
    struct sys_nh_ref_list_node_s* p_next;
};
typedef struct sys_nh_ref_list_node_s sys_nh_ref_list_node_t;

struct sys_nh_info_ext_s
{
    /*key*/
    uint32 nh_id;
    /*data*/
    sys_nh_ref_list_node_t* ecmp_list;/*ecmp nh list*/
    sys_nh_ref_list_node_t* aps_list;/*aps nh list*/
};
typedef struct sys_nh_info_ext_s sys_nh_info_ext_t;


struct sys_nh_info_com_hdr_s
{
    uint32 nh_id;
    uint32 nh_entry_flags; /*sys_nh_info_flag_type_t*/
    uint32 dsnh_offset;

    uint32 dsfwd_offset : 16;
    uint32 dsfwd1_offset : 16;/*AT*/

    uint32 dsnh_ptr    : 20;/*AT*/
    uint32 nh_entry_type : 8; /*sys_usw_nh_type_t*/
    uint32 dsnh_entry_num : 4;

};
typedef struct sys_nh_info_com_hdr_s sys_nh_info_com_hdr_t;


struct sys_nh_info_com_s
{
    sys_nh_info_com_hdr_t hdr;
};
typedef struct sys_nh_info_com_s sys_nh_info_com_t;

struct sys_nh_info_overlay_s
{
    sys_nh_info_com_hdr_t hdr;

    uint32 gport;
    uint32 dest_logic_port;/*For CTC_NH_OL_FLAG_LDP_ECMP is overlay ecmp nhid else is dest logic port*/
    uint32 nhid; /* nh of SYS_NH_TYPE_OVERLAY_VNI */
    uint32 ecmp_gid; /*ecmp gid*/
	uint8 is_ecmp_nh;
};
typedef struct sys_nh_info_overlay_s sys_nh_info_overlay_t;

struct sys_nh_param_mcast_member_s
{
    sys_nh_param_mcast_member_type_t member_type;
    void* p_1st_node;
    void* p_last_node;
    void* p_info_mcast;
    void* p_1st_node_vlanif;    
    uint32 pbm[CTC_PORT_BITMAP_IN_WORD];     /*set by user*/
    uint32 pbm_hw[CTC_PORT_BITMAP_IN_WORD];  /*read from hw(old info), update the pbm_hw then set to hw*/
    uint32  ref_nhid; /*Reference other nhid, eg egress vlan translation nhid*/
    uint32  destid; /*local portid, LAGID without 0x1F(e.g. 0x1F01), global dest chipid, aps bridge groupid*/
    uint16  vid; /*For IPMC*/
    uint16  cvid; /*For IPMC*/
    uint16  logic_port;
    uint16  fid;
    uint16 ref_list_cnt;
    uint16 ldp_ext;

    uint32   lchip:8; /*Local chip this member will be added to */
    uint32   l3if_type:3; /*ctc_l3if_type_t*/
    uint32   is_del:1;
    uint32   is_linkagg:1;
    uint32   is_protection_path:1; /*Used for aps bridge*/
    uint32   is_logic_port:1; /*if set,Met will do logic port check,apply to VPLS/WLAN/PBB/TRILL,etc.*/
    uint32   is_reflective:1;      /**< [GB] Mcast reflective */
    uint32   is_mirror:1;
    uint32   is_horizon_split:1;
    uint32   is_src_port_check_dis:1;
    uint32   is_destmap_profile:1;
    uint32   leaf_check_en:1;
    uint32   mtu_no_chk:1;
    uint32   cloud_sec_en:1;
    uint32   is_mcast_aps:1;
    uint32   logic_rep_ability:1;
    uint32   logic_port_type_en:1;
    uint32   is_ipmc_member:1;
    uint32   no_hw:1;
    uint32   rsv:4;
    uint8   stk_rsv_mem;
};
typedef struct sys_nh_param_mcast_member_s sys_nh_param_mcast_member_t;

enum sys_nh_param_brguc_sub_type_e
{
    SYS_NH_PARAM_BRGUC_SUB_TYPE_NONE =  0,
    SYS_NH_PARAM_BRGUC_SUB_TYPE_BASIC = 1,
    SYS_NH_PARAM_BRGUC_SUB_TYPE_BYPASS = 2,

    /*Output vlan edit*/
    SYS_NH_PARAM_BRGUC_SUB_TYPE_VLAN_EDIT = 3,
    /*SYS_NH_PARAM_BRGUC_SUB_TYPE_APS_VLAN_EDIT = 4,*/

    SYS_NH_PARAM_BRGUC_SUB_TYPE_MAX
};
typedef enum sys_nh_param_brguc_sub_type_e sys_nh_param_brguc_sub_type_t;

struct sys_nh_param_mcast_group_s
{
    uint32                      nhid;
    uint32                      opcode;  /*sys_nh_param_mcast_opcode_t */
    sys_nh_param_mcast_member_t mem_info;
    uint32                      fwd_offset;
    uint32                      stats_id;
    uint8                       stats_valid;
    uint8                       dsfwd_valid;
    uint8                       is_nhid_valid;
    uint8                       is_mirror;
    uint8                       is_mcast_profile;
    uint8                       flag;
};
typedef struct sys_nh_param_mcast_group_s sys_nh_param_mcast_group_t;

enum sys_nh_entry_change_type_e
{
    SYS_NH_CHANGE_TYPE_NULL,

    SYS_NH_CHANGE_TYPE_FWD_TO_UNROV,
    SYS_NH_CHANGE_TYPE_UNROV_TO_FWD,
    SYS_NH_CHANGE_TYPE_UPDATE_FWD_ATTR,

    SYS_NH_CHANGE_TYPE_FWD_TO_DISCARD,
    SYS_NH_CHANGE_TYPE_DISCARD_TO_FWD,

    SYS_NH_CHANGE_TYPE_ADD_DYNTBL,

    SYS_NH_CHANGE_TYPE_NH_DELETE,
    SYS_NH_CHANGE_TYPE_UPDATE_LDP,
    SYS_NH_CHANGE_TYPE_UPDATE_SRH,

    SYS_NH_CHANGE_TYPE_INVALID
};
typedef enum sys_nh_entry_change_type_e sys_nh_entry_change_type_t;

struct sys_nh_brguc_nhid_info_s
{
    uint32 nh_type_flag;
    uint32 brguc_untagged_nhid;
    uint32 brguc_nhid;
    uint32 bypass_nhid;
    uint32 ram_pkt_nhid;   /*No use*/
    uint32 srv_queue_nhid; /*No use*/
};
typedef struct sys_nh_brguc_nhid_info_s sys_nh_brguc_nhid_info_t;  /*No use*/


struct sys_nh_param_dsfwd_s
{
    uint32 dsfwd_offset;
    uint32 dsnh_offset;
    uint8 is_mcast;
    uint8 is_reflective;
    uint8 drop_pkt;
    uint8 nexthop_ext;
    uint8 is_lcpu;
    uint8 is_egress_edit;
    uint8 adjust_len_idx;
    uint8 aps_type;
    uint32 dest_id; /*UcastId or McastId*/
    uint8 dest_chipid; /*Destination global chip id*/
    uint8 cut_through_dis;
    uint32 stats_ptr; /*This entry's target local chipid*/
    uint32 is_cpu;
    uint8  use_destmap_profile;
    uint8  truncate_profile_id;
    uint8  cloud_sec_en;
    uint8  is_6w;
    uint8 is_dsfwd1;
    uint8 is_ecmp;
    uint16 logic_port;
    uint16 logic_port_ext;
};
typedef struct sys_nh_param_dsfwd_s sys_nh_param_dsfwd_t;

struct sys_nh_param_dsmet_s
{
    uint16 dest_id;
    uint32 next_met_entry_ptr;
    uint8 remote_chip;
    uint8 end_local_rep;
    uint32 met_offset;
    uint32 next_hop_ptr;
    uint8  aps_bridge_en;
    uint8  is_destmap_profile;
    uint8  is_linkagg;
    uint8  next_ext;

    /*valid for sys_usw_nh_update_dsmet*/
    uint8 next_met_entry_ptr_valid;
    uint8 next_hop_ptr_valid;
    uint8 dest_id_valid;
};
typedef struct sys_nh_param_dsmet_s sys_nh_param_dsmet_t;

struct sys_nh_update_oam_info_s
{
    uint8    is_protection_path;
    uint8    lock_en;
	uint8    lm_en;   /*if lm_en,indicate oam_mep_index is MEP identify */
    uint8    dsma_en; /*update dsma to nexthop info*/
	uint16   oam_mep_index;
    uint16   ma_idx;  /*valid when dsma_en is set to 1*/
    uint32   mpls_label;
    uint8    update_type; /*0:lm&lock*/
    uint8    mep_type;    /*0:bfd, 1:ethoam*/
    uint32   mep_index;
};
typedef struct sys_nh_update_oam_info_s sys_nh_update_oam_info_t;

struct sys_nh_repli_offset_node_s
{
    ctc_slistnode_t head;
    uint32 start_offset;
    uint32 bitmap;
    uint32 dest_gport;
    uint32 group_id;
};
typedef struct sys_nh_repli_offset_node_s sys_nh_repli_offset_node_t;

struct sys_nh_info_misc_s
{
    sys_nh_info_com_hdr_t hdr;
    sys_nh_info_bind_t* bind_data;

    uint32 gport;
    uint32 flag;

    uint32 dsl2edit_offset:16;
    uint32 dsl3edit_offset:16;
    uint32 next_l3edit_offset:16;
    uint32 l3ifid:13;
    uint32 stag_op       : 3;


    uint32 truncated_len:16;
    uint32 l3edit_entry_type  : 8;
    uint32 l2edit_entry_type  : 8;

    uint32 next_l3edit_entry_type   : 8;
    uint32 vlan_profile_id    : 6;
    uint32 cvid_sl            : 2;
    uint32 misc_nh_type  : 4;
    uint32 is_reflective : 1;

    uint32 packet_type   : 3;
    uint32 cvlan_edit_type : 3;
    uint32 svlan_edit_type : 3;
    uint32 scos_sl       : 2;
    uint32 ctag_op       : 3;
    uint32 svid_sl       : 2;
    uint32 ccos_sl       : 2;
    uint32 is_loop_nh    : 1;
    uint32 label_num     : 2;
    uint32 rsv           : 22;
};
typedef struct sys_nh_info_misc_s sys_nh_info_misc_t;

struct sys_nh_info_mcast_s
{
    sys_nh_info_com_hdr_t hdr;
    ctc_list_pointer_t   p_mem_list; /*sys_nh_mcast_meminfo_t*/

    uint32 profile_nh_id;      /* mcast profile nhid or stacking profile id*/

    uint32 physical_replication_num:16;
    uint32 mcast_flag:16;              /*refer to sys_nh_info_mcast_flag_t*/

    uint32 profile_ref_cnt:16;
    uint32 stats_ptr:16;

    uint32 basic_met_offset:20;/* basic_met_offset = group_id << met_mode */
    uint32 pp_bmp:8;          /* [AT]pp bitmap 0-7 */
    uint32 rsv:4;

    uint32 profile_met_offset:20; /*0-stacking; 1-mcast profile */
    uint32 rsv1:12;
};
typedef struct sys_nh_info_mcast_s sys_nh_info_mcast_t;

struct sys_nh_info_aps_s
{
    sys_nh_info_com_hdr_t hdr;
    sys_nh_info_bind_t* bind_data;
    uint32 w_nexthop_id;
    uint32 p_nexthop_id;

    uint32 ecmp_aps_met : 20;
    uint32 assign_port : 1;
    uint32 arp_num     : 2;
    uint32 aps_xcon_met: 1;
    uint32 rsv : 8;

    uint32 aps_group_id:16;
    uint32 rsv1        :16;
};
typedef struct sys_nh_info_aps_s sys_nh_info_aps_t;

/*Common Functions*/
extern int32
sys_usw_nh_api_init(uint8 lchip, ctc_nh_global_cfg_t* nh_cfg);
extern int32
sys_usw_nh_get_dsfwd_offset(uint8 lchip, uint32 nhid, uint32* p_offset, uint8 in_cb, uint8 feature);
extern int32
sys_usw_nh_get_dsfwd1_offset(uint8 lchip, uint32 nhid, uint32* p_offset, uint8 in_cb, uint8 feature);
extern int32
sys_usw_nh_get_emcp_if_l2edit_offset(uint8 lchip, uint32* p_l2edit_offset);
/*Ucast bridge functions*/
extern int32
sys_usw_brguc_nh_create(uint8 lchip, uint32 gport, ctc_nh_param_brguc_sub_type_t nh_type);
extern int32
sys_usw_brguc_nh_delete(uint8 lchip, uint32 gport);
extern int32
sys_usw_l2_get_ucast_nh(uint8 lchip, uint32 gport, ctc_nh_param_brguc_sub_type_t nh_type, uint32* nhid);
extern int32
sys_usw_nh_get_mcast_nh(uint8 lchip, uint32 group_id, uint32* nhid);
extern int32
sys_usw_nh_update_dot1ae(uint8 lchip, void* param);
extern int32
_sys_usw_nh_get_dsnh_offset_by_nhid(uint8 lchip, uint32 nhid,  uint32 *p_dsnh_offset, uint8 * p_use_dsnh8w);
extern int32
sys_usw_nh_get_l3ifid(uint8 lchip, uint32 nhid, uint16* p_l3ifid);
extern int32
sys_usw_nh_get_port(uint8 lchip, uint32 nhid, uint8* aps_brg_en, uint32* gport);
extern bool
sys_usw_nh_is_cpu_nhid(uint8 lchip, uint32 nhid);
/*Egress Vlan translation*/
extern int32
sys_usw_egress_vlan_edit_nh_create(uint8 lchip, uint32 nhid, uint32 gport,
                                         ctc_vlan_egress_edit_info_t* p_vlan_info,
                                         uint32 dsnh_offset,
                                         ctc_vlan_edit_nh_param_t* p_nh_param);
extern int32
sys_usw_egress_vlan_edit_nh_delete(uint8 lchip, uint32 nhid);

extern int32
sys_usw_egress_vlan_edit_nh_update(uint8 lchip, uint32 nhid,
                                         ctc_vlan_egress_edit_info_t* p_vlan_info,
                                         ctc_vlan_edit_nh_param_t* p_nh_param);

/*APS Egress Vlan translation*/
extern int32
sys_usw_aps_egress_vlan_edit_nh_create(uint8 lchip, uint32 nhid,
                                             uint32 dsnh_offset, uint16 aps_bridge_id,
                                             ctc_vlan_egress_edit_info_t* p_vlan_info_working_path,
                                             ctc_vlan_egress_edit_info_t* p_vlan_info_protection_path);
extern int32
sys_usw_aps_egress_vlan_edit_nh_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_mcast_nh_create(uint8 lchip, uint32 groupid,  sys_nh_param_mcast_group_t* p_nh_mcast_group);
extern int32
sys_usw_mcast_nh_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_mcast_nh_update(uint8 lchip, sys_nh_param_mcast_group_t* p_nh_mcast_group);
extern int32
sys_usw_nh_add_nexthop_mac(uint8 lchip, uint32 arp_id, ctc_nh_nexthop_mac_param_t* p_param);
extern int32
sys_usw_nh_free_rsv_resource(uint8 lchip);
extern int32
sys_usw_nh_remove_nexthop_mac(uint8 lchip, uint32 arp_id);
extern int32
sys_usw_nh_update_nexthop_mac(uint8 lchip, uint32 arp_id, ctc_nh_nexthop_mac_param_t* p_new_param);
extern int32
sys_usw_ipuc_nh_create(uint8 lchip, uint32 nhid, ctc_ip_nh_param_t* p_nh_param);
extern int32
sys_usw_ipuc_nh_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_ipuc_nh_update(uint8 lchip, uint32 nhid, ctc_ip_nh_param_t* p_ipuc_param, sys_nh_entry_change_type_t update_type);
extern int32
sys_usw_nh_get_ipuc_cb(uint8 lchip, sys_nh_info_com_t* p_nh_db, void* p_para);
extern int32
sys_usw_nh_bind_dsfwd_cb(uint8 lchip, uint32 nhid, sys_nh_update_dsnh_param_t* p_update_dsnh);
extern int32
sys_usw_nh_get_aps_working_path(uint8 lchip, uint32 nhid, uint32* gport, uint32* nexthop_ptr, bool* p_protect_en);
extern int32
sys_usw_nh_get_nhinfo(uint8 lchip, uint32 nhid, sys_nh_info_dsnh_t* p_nhinfo, uint8 in_cb);
extern int32
sys_usw_nh_get_reason_nhinfo(uint8 lchip, uint16 reason_id, uint32* nexthop_ptr,uint8* dsnh_8w);
int32
sys_usw_nh_get_overlay_tunnel_info(uint8 lchip, uint16 logic_dest_port, sys_nh_info_dsnh_t* p_nhinfo);
extern int32
sys_usw_mpls_nh_create_tunnel_label(uint8 lchip, uint16 tunnel_id, ctc_mpls_nexthop_tunnel_param_t* p_tunnel_param);
extern int32
sys_usw_mpls_nh_remove_tunnel_label(uint8 lchip, uint16 tunnel_id);
extern int32
sys_usw_mpls_nh_update_tunnel_label(uint8 lchip, uint16 tunnel_id, ctc_mpls_nexthop_tunnel_param_t* p_tunnel_paramm, ctc_slist_t* update_cb_list);
extern int32
sys_usw_mpls_nh_get_tunnel_label(uint8 lchip, uint16 tunnel_id, ctc_mpls_nexthop_tunnel_param_t* p_tunnel_param);
extern int32
sys_usw_mpls_nh_swap_tunnel(uint8 lchip, uint16 old_tunnel_id,uint16 new_tunnel_id);
extern int32
sys_usw_mpls_nh_create(uint8 lchip, uint32 nhid, ctc_mpls_nexthop_param_t* p_nh_param);
extern int32
sys_usw_mpls_nh_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_mpls_nh_update(uint8 lchip, uint32 nhid, ctc_mpls_nexthop_param_t* p_nh_param, sys_nh_entry_change_type_t change_type);
extern int32
sys_usw_nh_update_oam_en(uint8 lchip, uint32 nhid,sys_nh_update_oam_info_t *p_oam_info);
extern int32
sys_usw_iloop_nh_create(uint8 lchip, uint32 nhid, ctc_loopback_nexthop_param_t* p_nh_param);
extern int32
sys_usw_iloop_nh_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_rspan_nh_create(uint8 lchip, uint32* nhid, uint32 dsnh_offset, ctc_rspan_nexthop_param_t* p_nh_param);
extern int32
sys_usw_rspan_nh_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_nh_dump_mcast(uint8 lchip, uint32 nhid, bool detail);
extern int32
sys_usw_nh_dump(uint8 lchip, uint32 nhid, bool detail);
extern int32
sys_usw_ecmp_nh_create(uint8 lchip, uint32 nhid, ctc_nh_ecmp_nh_param_t* pdata);
extern int32
sys_usw_ecmp_nh_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_ecmp_nh_update(uint8 lchip, uint32 nhid, ctc_nh_ecmp_nh_param_t* pdata);
extern int32
sys_usw_nh_set_max_ecmp(uint8 lchip, uint16 max_ecmp);
extern int32
sys_usw_ip_tunnel_nh_create(uint8 lchip, uint32 nhid, ctc_ip_tunnel_nh_param_t* p_nh_param);
extern int32
sys_usw_ip_tunnel_nh_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_ip_tunnel_nh_update(uint8 lchip, uint32 nhid, ctc_ip_tunnel_nh_param_t* p_nh_param);
extern int32
sys_usw_wlan_tunnel_nh_create(uint8 lchip, uint32 nhid, ctc_nh_wlan_tunnel_param_t* p_nh_param);
extern int32
sys_usw_wlan_tunnel_nh_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_wlan_tunnel_nh_update(uint8 lchip, uint32 nhid, ctc_nh_wlan_tunnel_param_t* p_nh_param);
extern int32
sys_usw_nh_wlan_create_reserve_nh(uint8 lchip, sys_nh_entry_table_type_t nh_type, uint32* p_data);
extern int32
sys_usw_nh_add_misc(uint8 lchip, uint32* nhid, ctc_misc_nh_param_t* p_nh_param, bool is_internal_nh);
extern int32
sys_usw_nh_remove_misc(uint8 lchip, uint32 nhid);
extern int32
sys_usw_nh_trill_create(uint8 lchip, uint32 nhid, ctc_nh_trill_param_t* p_nh_param);
extern int32
sys_usw_nh_trill_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_nh_trill_update(uint8 lchip, uint32 nhid, ctc_nh_trill_param_t* p_nh_param);
extern int32
sys_usw_nh_add_srh_edit(uint8 lchip, uint32* srh_id, ctc_nh_srh_edit_param_t* p_nh_param);
extern int32
sys_usw_nh_remove_srh_edit(uint8 lchip, uint32 srh_id);
extern int32
sys_usw_nh_update_srh_edit(uint8 lchip, uint32 srh_id, ctc_nh_srh_edit_param_t* p_nh_param);
extern int32
sys_usw_nh_srv6_create(uint8 lchip, uint32 nhid, ctc_nh_srv6_param_t* p_nh_param);
extern int32
sys_usw_nh_srv6_delete(uint8 lchip, uint32 nhid);
extern int32
sys_usw_nh_srv6_update(uint8 lchip, uint32 nhid, ctc_nh_srv6_param_t* p_nh_param);
extern int32
sys_usw_nh_add_overlay_tunnel(uint8 lchip, uint32 ldp, ctc_nh_ol_tunnel_t* p_ol_tunnel);
extern int32
sys_usw_nh_remove_overlay_tunnel(uint8 lchip, uint32 ldp);
extern int32
sys_usw_nh_update_overlay_tunnel(uint8 lchip, uint32 ldp, ctc_nh_ol_tunnel_t* p_ol_tunnel);
extern int32
sys_usw_nh_add_overlay_vni(uint8 lchip, uint32* ol_vni, ctc_nh_ol_vni_t* p_ol_vni);
extern int32
sys_usw_nh_remove_overlay_vni(uint8 lchip, uint32 ol_vni);
extern int32
sys_usw_nh_update_overlay_vni(uint8 lchip, uint32 ol_vni, ctc_nh_ol_vni_t* p_ol_vni);
extern int32
sys_usw_nh_add_overlay(uint8 lchip, uint32 nhid, ctc_nh_overlay_param_t* p_nh_param);
extern int32
sys_usw_nh_remove_overlay(uint8 lchip, uint32 nhid);
extern int32
sys_usw_nh_api_deinit(uint8 lchip);
extern int32
sys_usw_nh_unbind_dsfwd_cb(uint8 lchip, uint32 nhid);
extern int32
sys_usw_nh_get_nhinfo_by_nhid(uint8 lchip, uint32 nhid, sys_nh_info_com_t** pp_nhinfo);
extern int32
sys_usw_nh_get_resolved_offset(uint8 lchip, sys_usw_nh_res_offset_type_t type, uint32* p_offset);
extern int32
sys_usw_nh_is_logic_repli_en(uint8 lchip, uint32 nhid, uint8 *is_repli_en);
extern int32
sys_usw_nh_remove_nexthop_mac(uint8 lchip, uint32 arp_id);
extern int32
sys_usw_nh_update_nexthop_mac(uint8 lchip, uint32 arp_id, ctc_nh_nexthop_mac_param_t* p_new_param);
extern int32
sys_usw_nh_add_nexthop_mac(uint8 lchip, uint32 arp_id, ctc_nh_nexthop_mac_param_t* p_param);
extern int32
sys_usw_nh_del_ipmc_dsnh_offset(uint8 lchip, uint16 l3ifid);
extern int32
sys_usw_nh_get_current_ecmp_group_num(uint8 lchip, uint16* cur_group_num);
extern int32
sys_usw_nh_alloc_ecmp_offset(uint8 lchip, uint8 is_grp, uint8 entry_num, uint32* p_offset);
extern int32
sys_usw_nh_free_ecmp_offset(uint8 lchip, uint8 is_grp, uint8 entry_num, uint32 offset);
extern int32
sys_usw_nh_get_max_ecmp_group_num(uint8 lchip, uint16* max_group_num, uint8* hecmp_en);
extern int32
sys_usw_nh_get_max_ecmp(uint8 lchip, uint16* max_ecmp);
extern int32
sys_usw_nh_add_dsfwd(uint8 lchip, sys_nh_param_dsfwd_t* p_dsfwd_param);
extern int32
sys_usw_nh_add_dsmet(uint8 lchip, sys_nh_param_dsmet_t* p_met_param, uint8 in_cb);
extern int32
sys_usw_nh_get_dsmet(uint8 lchip, uint32 met_offset, sys_nh_param_dsmet_t* dsmet_param);
extern int32
sys_usw_nh_update_dsmet(uint8 lchip, uint32 met_offset, sys_nh_param_dsmet_t* dsmet_param);
extern int32
sys_usw_nh_set_glb_met_offset(uint8 lchip, uint32 start_offset, uint32 entry_num, bool is_set);
extern int32
sys_usw_nh_get_mcast_profile_offset(uint8 lchip, uint32 nh_id, uint32* met_offset);
extern int32
sys_usw_nh_check_glb_met_offset(uint8 lchip, uint32 start_offset, uint32 entry_num,bool should_not_inuse);
extern int32
sys_usw_nh_traverse_nh_db(uint8 lchip, hash_traversal_fn fn, void* data);
extern int32
sys_usw_nh_update_dsfwd(uint8 lchip, sys_nh_update_dsfwd_t* p_update_param);
extern int32
sys_usw_nh_get_fatal_excp_dsnh_offset(uint8 lchip, uint32* p_offset);
extern int32
sys_usw_nh_get_max_external_nhid(uint8 lchip, uint32* nhid);
extern int32
sys_usw_nh_get_mirror_info_by_nhid(uint8 lchip, uint32 nhid, uint32* dsnh_offset, uint32* gport, bool enable);
extern int32
sys_usw_nh_get_reflective_dsfwd_offset(uint8 lchip, uint32* p_dsfwd_offset);
extern int32
sys_usw_nh_map_destmap_to_port(uint8 lchip, uint32 destmap, uint32 *gport);
extern int32
sys_usw_nh_set_bpe_en(uint8 lchip, bool enable);
extern int32
sys_usw_nh_get_bpe_en(uint8 lchip, uint8* enable);
extern int32
sys_usw_nh_set_bpe_mc_en(uint8 lchip, uint8 enable);
extern int32
sys_usw_nh_get_mcast_member(uint8 lchip, uint32 nhid, ctc_nh_info_t* p_nh_info);
extern int32
sys_usw_nh_get_dsnh_offset_by_nhid(uint8 lchip, uint32 nhid,  uint32 *p_dsnh_offset, uint8 * p_use_dsnh8w);
extern int32
sys_usw_nh_get_mcast_member_info(uint8 lchip, sys_nh_info_mcast_t* p_mcast_db, ctc_nh_info_t* p_nh_info);
extern int32
sys_usw_nh_vxlan_vni_init(uint8 lchip);
extern int32
sys_usw_nh_alloc_ecmp_offset_from_position(uint8 lchip, uint8 is_grp, uint8 entry_num, uint32 offset);
extern bool
sys_usw_nh_is_ipmc_logic_rep_enable(uint8 lchip);
extern int32
sys_usw_nh_set_ipmc_logic_replication(uint8 lchip, uint8 enable);
extern int32
sys_usw_nh_add_udf_profile(uint8 lchip, ctc_nh_udf_profile_param_t* p_edit);
extern int32
sys_usw_nh_remove_udf_profile(uint8 lchip, uint8 profile_id);
extern int32
sys_usw_misc_nh_update(uint8 lchip, uint32 nhid, ctc_misc_nh_param_t* p_nh_param,
                             sys_nh_entry_change_type_t update_type);
extern int32
sys_usw_nh_add_l3edit_natsa(uint8 lchip, uint32* ipsa, uint16 src_port, uint32* p_offset, uint8 double_nat, uint8 is_ipv6, uint8 masklen);
extern int32
sys_usw_nh_remove_l3edit_natsa(uint8 lchip, uint32* ipsa, uint16 src_port, uint32 offset, uint8 double_nat, uint8 is_ipv6, uint8 masklen);
extern int32
sys_usw_nh_set_efd_redirect_nh(uint8 lchip, uint32 nh_id);
extern int32
sys_usw_nh_get_efd_redirect_nh(uint8 lchip, uint32* p_nh_id);
extern int32
sys_usw_nh_traverse_mcast(uint8 lchip, ctc_nh_mcast_traverse_fn fn, ctc_nh_mcast_traverse_t* p_data);
extern int32
sys_usw_nh_set_vpws_vpnid(uint8 lchip, uint32 nhid, uint32 vpn_id);
extern int32
sys_usw_nh_add_fp(uint8 lchip, ctc_nh_fp_edit_t* p_edit, uint8 is_internal);
extern int32
sys_usw_nh_remove_fp(uint8 lchip, uint32 fp_id);
extern int32
sys_usw_nh_update_fp(uint8 lchip, ctc_nh_fp_edit_t* p_edit);
extern int32
sys_usw_nh_get_fp_info(uint8 lchip, uint32 fp_id, sys_nh_info_dsnh_t* p_fp_info);
extern int32
sys_usw_nh_get_rsv_iloop(uint8 lchip, uint8 dp_id, uint32* nhid);
extern int32
sys_usw_nexthop_dump_db(uint8 lchip, sal_file_t p_f, ctc_global_dump_db_t* p_dump_param);
extern int32
sys_usw_nh_set_pw_working_path(uint8 lchip, uint32 nhid, uint8 is_working);
extern int32
sys_usw_nh_get_nh_resource(uint8 lchip, sys_api_nh_entry_type_t type, uint32* used_count);
extern int32
sys_usw_nh_api_get(uint8 lchip, uint32 nhid, void* p_nh_para);
extern int32
sys_usw_mpls_nh_create_tunnel_label_api(uint8 lchip, uint16 tunnel_id,
                                           ctc_mpls_nexthop_tunnel_param_t* p_nh_param);
extern int32
sys_usw_mpls_nh_remove_tunnel_label_api(uint8 lchip, uint16 tunnel_id);
extern int32
sys_usw_mpls_nh_update_tunnel_label_api(uint8 lchip, uint16 tunnel_id, ctc_mpls_nexthop_tunnel_param_t* p_tunnel_param);
extern int32
sys_usw_mpls_nh_get_tunnel_label_api(uint8 lchip, uint16 tunnel_id, ctc_mpls_nexthop_tunnel_param_t* p_param);
extern int32
sys_usw_mpls_nh_swap_tunnel_api(uint8 lchip, uint16 old_tunnel_id, uint16 new_tunnel_id);
extern int32
sys_usw_aps_nh_create(uint8 lchip, uint32 nhid, ctc_nh_aps_param_t* p_nh_parama);
extern int32
sys_usw_aps_nh_delete(uint8 lchip, uint32 id, uint8 type);
extern int32
sys_usw_aps_nh_update(uint8 lchip, uint32 nhid, ctc_nh_aps_param_t* p_nh_param);
extern int32
sys_usw_nh_set_max_hecmp(uint8 lchip, uint32 max_num);
extern int32
sys_usw_nh_get_max_hecmp(uint8 lchip, uint32* max_ecmp);
extern int32
sys_usw_nh_wb_restore_edit(uint8 lchip, uint8 entry_type, uint32 edit_ptr);
extern int32
sys_usw_nh_get_dsmet_end_offset(uint8 lchip, uint32* met_entry_ptr);
extern int32
sys_usw_nh_add_nsh_edit(uint8 lchip, uint16 nsh_id, ctc_nh_nsh_param_t* nsh_info);
extern int32
sys_usw_nh_update_nsh_edit(uint8 lchip, uint16 nsh_id, ctc_nh_nsh_param_t* nsh_info);
extern int32
sys_usw_nh_remove_nsh_edit(uint8 lchip, uint16 nsh_id);
extern int32
sys_usw_nh_get_overlay_tunnel(uint8 lchip, uint32 ldp, ctc_nh_ol_tunnel_t* p_ol_tunnel);
extern int32
sys_usw_nh_update_overlay(uint8 lchip, uint32 nhid, ctc_nh_overlay_param_t* p_nh_param);
extern int32
sys_usw_nh_ecmp_get_lb_hash_mem_api(uint8 lchip, uint32 ecmp_nh_id, uint16 hash_value, uint32 * p_nh_id);

extern int32
sys_usw_nh_set_bridge_inner_mode(uint8 lchip, uint8 mode);
extern uint8
sys_usw_nh_get_vxlan_mode(uint8 lchip);
extern int32
sys_usw_nh_remove_mcast_all_members_api(uint8 lchip, uint32 nhid);
extern int32
sys_usw_nh_replace_mcast_members_api(uint8 lchip, uint32 nhid, ctc_mcast_nh_param_member_t* mem_array, uint32 mem_num);
/*#endif*/
#ifdef __cplusplus
}
#endif

#endif /*_SYS_NEXTHOP_H_*/

